//*************************************************************************
// BCMenu.h : header file
// Version : 2.4
// Date : Feb 11, 1999
// Author : Brent Corkum
// 
// Portions of code supplied by:
// Ben Ashley,Girish Bharadwaj,Jean-Edouard Lachand-Robert,
// Robert Edward Caldecott,Kenny Goers,Leonardo Zide,
// Stefan Kuhr
//
// Bug Fixes:
// Stefan Kuhr,Martin Vladic,Kim Yoo Chul
//
// You are free to use/modify this code but leave this header intact.
//

#ifndef BCMenu_H
#define BCMenu_H

#include <afxtempl.h>

// BCMenuData class. Fill this class structure to define a single menu item:

//##ModelId=431C34D0000F
class BCMenuData
{
	//##ModelId=431C34D0001F
    wchar_t *m_szMenuText;
public:
	//##ModelId=431C34D0002E
    int xoffset;
	//##ModelId=431C34D0003E
    int menuIconNormal;
    UINT nFlags,nID,syncflag;
	//##ModelId=431C34D00040
    CImageList *bitmap;
	//##ModelId=431C34D0004E
    void *pContext; // user data

	//##ModelId=431C34D0005D
    BCMenuData () : pContext(NULL)
    {
        menuIconNormal=-1;xoffset=-1;bitmap=NULL;
        nFlags=0;nID=0;syncflag=0;m_szMenuText=NULL;
    };
	//##ModelId=431C34D0005E
    ~BCMenuData ();
	//##ModelId=431C34D0008C
    void SetAnsiString(LPCSTR szAnsiString);
	//##ModelId=431C34D000CB
    void SetWideString(const wchar_t *szWideString);
	//##ModelId=431C34D000FA
    const wchar_t *GetWideString(void) {return m_szMenuText;};
	//##ModelId=431C34D0010A
    CString GetString(void);//returns the menu text in ANSI or UNICODE
};

//struct CMenuItemInfo : public MENUITEMINFO {
//##ModelId=431C34D00148
struct CMenuItemInfo : public 
//MENUITEMINFO 
#ifndef UNICODE   //SK: this fixes warning C4097: typedef-name 'MENUITEMINFO' used as synonym for class-name 'tagMENUITEMINFOA'
tagMENUITEMINFOA
#else
tagMENUITEMINFOW
#endif
    {
	//##ModelId=431C34D00168
	CMenuItemInfo()
	{ memset(this, 0, sizeof(MENUITEMINFO));
	  cbSize = sizeof(MENUITEMINFO);
	}
};




//##ModelId=431C34D00177
typedef enum {Normal,TextOnly} HIGHLIGHTSTYLE;

#ifndef UNICODE
#define AppendODMenu AppendODMenuA
#define ModifyODMenu ModifyODMenuA
#else
#define AppendODMenu AppendODMenuW
#define ModifyODMenu ModifyODMenuW
#endif



//##ModelId=431C34D0031C
class BCMenu : public CMenu  // Derived from CMenu
{
// Construction
public:
	//##ModelId=431C34D0033D
BCMenu(); 
// Attributes
protected:
	//##ModelId=431C34D0036C
CTypedPtrArray<CPtrArray, BCMenuData*> m_MenuList;  // Stores list of menu items 
// When loading an owner-drawn menu using a Resource, BCMenu must keep track of
// the popup menu's that it creates. Warning, this list *MUST* be destroyed
// last item first :)

	//##ModelId=431C34D0038D
CTypedPtrArray<CPtrArray, BCMenu*>  m_SubMenus;  // Stores list of sub-menus 
// Operations
public: 
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCustomMenu)
//}}AFX_VIRTUAL 
// Implementation
public:
	//##ModelId=431C34D00399
  static BOOL IsNewShell(void);
	//##ModelId=431C34D003D8
  void SetBitmapBackground(COLORREF color);
	//##ModelId=431C34D1000F
  void SetDisableOldStyle(void);
	//##ModelId=431C34D10011
  void UnSetDisableOldStyle(void);
	//##ModelId=431C34D10020
  BOOL GetDisableOldStyle(void);
	//##ModelId=431C34D1002E
  void UnSetBitmapBackground(void);
	//##ModelId=431C34D1003E
  int AddBitmapToImageList(CImageList *list,UINT nResourceID);
	//##ModelId=431C34D1004F
  BOOL LoadFromToolBar(UINT nID,UINT nToolBar,int& xoffset);
	//##ModelId=431C34D1007D
  void InsertSpaces(void);
	//##ModelId=431C34D1008C
  static LRESULT FindKeyboardShortcut(UINT nChar,UINT nFlags,CMenu *pMenu);
	//##ModelId=431C34D100AB
  static void UpdateMenu(CMenu *pmenu);
	//##ModelId=431C34D100BD
  BOOL IsMenu(CMenu *submenu);
	//##ModelId=431C34D100FA
  void DrawCheckMark(CDC *pDC,int x,int y,COLORREF color);
	//##ModelId=431C34D10128
  void DrawRadioDot(CDC *pDC,int x,int y,COLORREF color);
	//##ModelId=431C34D10157
  BCMenu *FindMenuOption(int nId,int& nLoc);
	//##ModelId=431C34D10177
  BCMenuData *FindMenuOption(wchar_t *lpstrText);
	//##ModelId=431C34D101B5
  BOOL GetMenuText(UINT id,CString &string);
	//##ModelId=431C34D101D5
  CImageList *checkmaps;
	//##ModelId=431C34D101F4
  BOOL m_bDynIcons;
	//##ModelId=431C34D101F5
  BOOL checkmapsshare;
	//##ModelId=431C34D10203
  int m_selectcheck;
	//##ModelId=431C34D10213
  int m_unselectcheck;
	//##ModelId=431C34D10214
  void LoadCheckmarkBitmap(int unselect,int select);
	//##ModelId=431C34D10232
  void DitherBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, 
                 int nHeight, HBITMAP hbm, int nXSrc, int nYSrc);
	//##ModelId=431C34D10280
  void DitherBlt2(CDC *drawdc, int nXDest, int nYDest, int nWidth, 
                  int nHeight, CBitmap &bmp, int nXSrc, int nYSrc);
	//##ModelId=431C34D102CE
  HBITMAP LoadSysColorBitmap(int nResourceId);

	//##ModelId=431C34D102DF
virtual ~BCMenu();  // Virtual Destructor 
// Drawing: 
	//##ModelId=431C34D1030D
virtual void DrawItem( LPDRAWITEMSTRUCT);  // Draw an item
	//##ModelId=431C34D1035B
virtual void MeasureItem( LPMEASUREITEMSTRUCT );  // Measure an item

// Customizing:

	//##ModelId=431C34D1037A
void SetIconSize (int, int);  // Set icon size

	//##ModelId=431C34D103A9
BOOL AppendODMenuA(LPCSTR   lpstrText, UINT nFlags = MF_OWNERDRAW, UINT nID = 0, int nIconNormal = -1); // Owner-Drawn Append 
	//##ModelId=431C34D20000
BOOL AppendODMenuW(wchar_t *lpstrText, UINT nFlags = MF_OWNERDRAW, UINT nID = 0, int nIconNormal = -1); // Owner-Drawn Append 
	//##ModelId=431C34D2003E
BOOL AppendODMenuA(LPCSTR   lpstrText, UINT nFlags = MF_OWNERDRAW, BCMenu *pSubMenu = NULL, int nIconNormal = -1); // Owner-Drawn Append 
	//##ModelId=431C34D2006D
BOOL AppendODMenuW(wchar_t *lpstrText, UINT nFlags = MF_OWNERDRAW, BCMenu *pSubMenu = NULL, int nIconNormal = -1); // Owner-Drawn Append 


	//##ModelId=431C34D2009C
BOOL ModifyODMenuA(const char *lpstrText,UINT nID=0,int nIconNormal=-1);
	//##ModelId=431C34D200CB
BOOL ModifyODMenuA(const char *lpstrText,const char *OptionText,int nIconNormal);
	//##ModelId=431C34D200FA
BOOL ModifyODMenuW(wchar_t *lpstrText,UINT nID=0,int nIconNormal=-1);
	//##ModelId=431C34D20128
BOOL ModifyODMenuW(wchar_t *lpstrText,wchar_t *OptionText,int nIconNormal);
	//##ModelId=431C34D20148
BCMenuData *NewODMenu(UINT pos,UINT nFlags,UINT nID,CString string);
	//##ModelId=431C34D20177
void SynchronizeMenu(void);
	//##ModelId=431C34D20187
void BCMenu::InitializeMenuList(int value);
	//##ModelId=431C34D201A5
void BCMenu::DeleteMenuList(void);
	//##ModelId=431C34D201A7
BCMenuData *BCMenu::FindMenuList(UINT nID);
	//##ModelId=431C34D201D4
BCMenuData *BCMenu::FindMenuListEx(UINT nID);
	//##ModelId=431C34D201E5
virtual BOOL LoadMenu(LPCTSTR lpszResourceName);  // Load a menu
	//##ModelId=431C34D20203
virtual BOOL LoadMenu(int nResource);  // ... 
	//##ModelId=431C34D20222
void AddFromToolBar(CToolBar* pToolBar, int nResourceID);
	//##ModelId=431C34D20242
BOOL Draw3DCheckmark(CDC *dc, const CRect& rc,BOOL bSelected,
                     HBITMAP hbmCheck);
	//##ModelId=431C34D20262
BOOL LoadToolbar(UINT nToolBar);
	//##ModelId=431C34D20280
BOOL LoadToolbars(const UINT *arID,int n);

// Destoying:

	//##ModelId=431C34D2029F
virtual BOOL DestroyMenu();

// Generated message map functions
protected:
int m_iconX,m_iconY;
	//##ModelId=431C34D202DE
COLORREF m_bitmapBackground;
	//##ModelId=431C34D202DF
BOOL m_bitmapBackgroundFlag;
	//##ModelId=431C34D202EE
BOOL disable_old_style;
}; 

#endif

//*************************************************************************
